package moodish.server;

import java.util.Collection;
import java.util.HashMap;

public class User
{
	private String					username;
	private HashMap<String, User>	friends	= new HashMap<String, User>();

	public User(String username)
	{
		this.username = username;
		friends.put(username, this);
	}

	public String getUsername()
	{
		return username;
	}
	public boolean unfriend(String username)
	{
		return friends.remove(username) != null;
	}
	public boolean friend(User user)
	{
		return friends.put(user.getUsername(), user) != null;
	}

	public Collection<User> getFriends()
	{
		return friends.values();
	}

	public boolean isFriend(String usernameNewFriend)
	{
		return friends.containsKey(usernameNewFriend);
	}
}
